.TH E1432_ASSIGN_CHANNEL_NUMBERS 3 E1432
.SH NAME
.nf
e1432_assign_channel_numbers \- Preset and assign IDs to E1432s
e1432_assign_channels \- Assign IDs to E1432s
.fi
.IX e1432_assign_channel_numbers(3) 3
.IX e1432_assign_channels(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_assign_channel_numbers(SHORTSIZ16 nmod,
                                        SHORTSIZ16 *la_list,
                                        E1432ID *hw)
SHORTSIZ16 e1432_assign_channels(SHORTSIZ16 nmod,
                                 SHORTSIZ16 *la_list,
                                 E1432ID *hw,
                                 int preset)
.cE
.SH DESCRIPTION
One of \fIe1432_assign_channel_numbers\fR or
\fIe1432_assign_channels\fR must be called exactly once, following a
call to \fIe1432_init_io_driver\fR, in order to declare to the library
the logical addresses of the E1432 modules that will be used.

These two functions are identical, except that
\fIe1432_assign_channels\fR has an additional parameter to specify
whether the modules should all be preset.  A normal user typically
would use \fIe1432_assign_channel_numbers\fR, which is exactly
equivalent to:
.cS
e1432_assign_channels(nmod, la_list, hw, 1)
.cE

\fInmod\fR is the count of logical addresses passed in the second
parameter, \fIla_list\fR.  This number should be between \fB0\fR and
\fB255\fR.  A value of zero means that the function should free all
memory allocated by a previous call to
\fIe1432_assign_channel_numbers\fR or \fIe1432_assign_channels\fR, and
do nothing else.

\fIla_list\fR is the pointer to the list of logical addresses to be
used by the library.  Logical addresses have values ranging between
\fB1\fR and \fB255\fR.  All modules in the \fIla_list\fR are preset to
their power-up state, as with \fIe1432_preset\fR.  There is no
requirement that the \fIla_list\fR array be in numerically increasing
order.  The channel numbers will start at one in the first logical
address and increase in value in the same order that the logical
addresses are found in the array.

The function returns in \fIhw\fR a hardware ID which is used when
calling most other E1432 Host Interface library functions.

\fIpreset\fR specifies whether the preset the modules.  If non-zero,
the modules are preset before the function returns.

This function checks the existence of an E1432 module at each of the
logical addresses given in \fIla_list\fR, and allocates logical
channel identifiers for each channel in all of the E1432s.  Input
channels, source channels, and tach/trigger channels are kept
logically separated.  Channel numbers for each type of channel are
numbered starting from one, so there will be input channels 1 through
M, source channels 1 through N, and tach/trigger channels 1 through P,
where M is the number of input channels, N is the number of source
channels, and P is the number of tach/trigger channels.

As an example, suppose two logical addresses 100 and 101 are passed to
the function, and the logical address 100 has two 4-channel input SCAs
and an Option AYF 2-channel tachometer input, while logical address
101 has three 4-channel input SCAs and an Option 1D4 single-channel
source board.  In this case, input channel IDs 1 through 8 are
assigned to the eight input channels at logical address 100, while
input channel IDs 9 through 20 are assigned to the twelve input
channels at logical address 101.  Tach/trigger channel IDs number 1
and 2 are assigned to the two tach/trigger channels at logical address
100, and Source channel ID number 1 is assigned to the source channel
at logical address 101.

This function dynamically allocates memory using \fImalloc(3)\fR, in
order to store the internal structures kept for each channel and each
module.

When programming for multiple mainframe environments, where two or
more mainframes are connected by an MXI interface, there are some
limitations and special cases that need to be accounted for.  The
TTLTRG lines that are used by the E1432 to sync multiple module
measurements are unidirectional through the MXI interface, so this
restricts which modules can drive the TTLTRG lines.  The
e1432_read_xxx_data() function should use a group ID, not just channel
IDs.  See the manual page \fIe1432_multimain(5)\fR for more info.

.SH "RESET VALUE"
Not applicable.
.SH "RETURN VALUE"
Return 0 if successful, a (negative) error number otherwise.
.SH "SEE ALSO"
.na
e1432_create_channel_group, e1432_delete_all_chan_groups,
e1432_init_io_driver, e1432_preset, e1432_e1431_diff(5), e1432_id(5),
e1432_multimain(5)
.ad
